package com.rockcent.api.impl;

import android.text.TextUtils;

import com.google.gson.reflect.TypeToken;
import com.rockcent.api.ApiResponse;
import com.rockcent.api.KcuponApi;
import com.rockcent.api.net.HttpEngine;
import com.rockcent.api.utils.EncryptUtil;
import com.rockcent.model.AddressModel;
import com.rockcent.model.BClientCustomerBO;
import com.rockcent.model.ContourMap;
import com.rockcent.model.CouponBO;
import com.rockcent.model.CouponModel;
import com.rockcent.model.CouponStore;
import com.rockcent.model.CustomerBO;
import com.rockcent.model.DeliveryModel;
import com.rockcent.model.IndustryGroupModel;
import com.rockcent.model.MessageBO;
import com.rockcent.model.OrderInfo;
import com.rockcent.model.OrderModel;
import com.rockcent.model.VerificationModel;
import com.rockcent.model.WalletModel;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 描述信息
 *
 * @author keegan
 * @date 15/8/6
 */
public class KcuponApiImpl implements KcuponApi {

    private final static String REQUEST_TIMEOUT = "连接超时，请检查网络或稍后重试";

    private HttpEngine httpEngine;

    public KcuponApiImpl(String serverUrl) {
        httpEngine = new HttpEngine(serverUrl);
    }

    public ApiResponse<String> startVerificationDelivery(int verificatonId, int provinceId, String provinceName, int cityId, String cityName, int countyId, String countyName, String address, String addressee, String linkPhone, String remark) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("verificationId", String.valueOf(verificatonId));
        paramMap.put("provinceId", String.valueOf(provinceId));
        paramMap.put("provinceName", provinceName);
        paramMap.put("cityId", String.valueOf(cityId));
        paramMap.put("cityName", cityName);
        paramMap.put("countyId", countyId + "");
        paramMap.put("countyName", countyName);
        paramMap.put("Address", address);
        paramMap.put("addressee", addressee);
        paramMap.put("linkphone", linkPhone);
        paramMap.put("remark", remark);
        paramMap.put("method", START_VERIFICATION_DELIVERY);
        Type type = new TypeToken<ApiResponse<String>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<String>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<Void> initPayPass(String loginName, String loginPassword, String payPassword) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("loginPassword", EncryptUtil.makeMD5(loginPassword));
        paramMap.put("payPassword", EncryptUtil.makeMD5(payPassword));
        paramMap.put("method", INIT_PAYPASS);
        Type type = new TypeToken<ApiResponse<Void>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Void>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<Void> findPassByPhone(String loginName, String password, String code) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("password", EncryptUtil.makeMD5(password));
        paramMap.put("code", code);
        paramMap.put("method", FIND_PASS_BY_PHONE);
        Type type = new TypeToken<ApiResponse<Void>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Void>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<BClientCustomerBO> getBClientCustomer(String loginName) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("method", GET_BCLIENT_CUSTOMER);
        Type type = new TypeToken<ApiResponse<BClientCustomerBO>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<BClientCustomerBO>(REQUEST_TIMEOUT + e.toString());
        }
    }

    public ApiResponse<WalletModel> getCustomerWallet(String loginName) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("method", GET_CUSTOMER_WALLET);
        Type type = new TypeToken<ApiResponse<WalletModel>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<WalletModel>(REQUEST_TIMEOUT + " " + e.toString());
        }
    }

    public ApiResponse<String> getSmsCode4Register(String phoneNum) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("phoneNum", phoneNum);
        paramMap.put("method", GET_SMS_CODE_FOR_REGISTER);
        Type type = new TypeToken<ApiResponse<String>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<String>(REQUEST_TIMEOUT);
        }
    }

    public ApiResponse<List<CouponModel>> listCouponWallet(String loginName, String keyWords, int state, int type, int currentPage, int pageSize) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("keyWords", keyWords);
        paramMap.put("state", String.valueOf(state));
        paramMap.put("type", String.valueOf(type));
        paramMap.put("pageSize", String.valueOf(pageSize));
        paramMap.put("currentPage", String.valueOf(currentPage));
        paramMap.put("method", LIST_COUPON_WALLET);
        Type typeListCouponWallet = new TypeToken<ApiResponse<List<CouponModel>>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, typeListCouponWallet);
        } catch (Exception e) {
            return new ApiResponse<List<CouponModel>>(REQUEST_TIMEOUT + "   " + e.toString());
        }
    }

    public ApiResponse<List<OrderModel>> listOrder(String loginName, String keyWords, String state, int pageSize, int currentPage) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("keyWords", keyWords);
        paramMap.put("state", state);
        paramMap.put("pageSize", pageSize + "");
        paramMap.put("currentPage", currentPage + "");
        paramMap.put("method", LIST_ORDER);
        Type type = new TypeToken<ApiResponse<List<OrderModel>>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<List<OrderModel>>(REQUEST_TIMEOUT + "   " + e.toString());
        }
    }

    @Override
    public ApiResponse<Void> sendSmsCode4GetLoginPassword(String phoneNum) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("phoneNum", phoneNum);
        paramMap.put("method", SEND_SMS_CODE_FOR_GET_LOGIN_PASSWORD);
        Type type = new TypeToken<ApiResponse<Void>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Void>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<List<CouponBO>> listCouponModel(String keyword, int modelType, int listType, int industryId, int currentPage, int pageSize, int locationId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("keyword", keyword);
        paramMap.put("modelType", String.valueOf(modelType));
        paramMap.put("listType", String.valueOf(listType));
        paramMap.put("industryId", String.valueOf(industryId));
        paramMap.put("currentPage", String.valueOf(currentPage));
        paramMap.put("pageSize", String.valueOf(pageSize));
        paramMap.put("locationId", String.valueOf(locationId));
        paramMap.put("method", LIST_COUPON_MODEl);
        Type type = new TypeToken<ApiResponse<List<CouponBO>>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<List<CouponBO>>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<CustomerBO> checkCustExist(String loginName) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("loginName", loginName);
            paramMap.put("method", CHECK_CUST_EXIST);
            Type type = new TypeToken<ApiResponse<CustomerBO>>() {
            }.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<Map<String, List<CouponModel>>> getPreferentialCoupon(String loginName, int cashModelId, int count) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("loginName", loginName);
            paramMap.put("cashModelId", String.valueOf(cashModelId));
            paramMap.put("count", String.valueOf(count));
            paramMap.put("method", GET_PREFERENTIAL_COUPON);
            Type type = new TypeToken<ApiResponse<Map<String, List<CouponModel>>>>() {
            }.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Map<String, List<CouponModel>>>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<List<MessageBO>> queryInmessage(String phone, int currentPage, int pageSize,String state) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("loginName", phone);
            paramMap.put("pageSize", String.valueOf(pageSize));
            paramMap.put("currentPage", String.valueOf(currentPage));
            paramMap.put("method", QUERY_INMESSAGE);
            if(!TextUtils.isEmpty(state)) {
                paramMap.put("state", state);
            }
            Type type = new TypeToken<ApiResponse<List<MessageBO>>>() {}.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<List<MessageBO>>(REQUEST_TIMEOUT);
        }
    }

    public ApiResponse<Map<String, Object>> calcPrice(String loginName, int buyModelId, int buyModelCnt, int usePlusModelId) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("loginName", loginName);
            paramMap.put("buyModelId", buyModelId);
            paramMap.put("buyModelCnt", buyModelCnt);
            paramMap.put("usePlusModelId", usePlusModelId);
            paramMap.put("method", CALC_PRICE);
            Type type = new TypeToken<ApiResponse<Map<String, Object>>>() {
            }.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<Void> readMessage(String loginName, int msgId) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("loginName", loginName);
            paramMap.put("msgId", String.valueOf(msgId));
            paramMap.put("method", READ_MESSAGE);
            Type type = new TypeToken<ApiResponse<Void>>() {
            }.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Void>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<Integer> realnameAuth(String loginName, String realname, String idnum, String idPicUrl, String idBackPicUrl) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("loginName", loginName);
            paramMap.put("realname", realname);
            paramMap.put("idnum", idnum);
            paramMap.put("idPicUrl", idPicUrl);
            paramMap.put("idBackPicUrl", idBackPicUrl);
            paramMap.put("method", REALNAME_AUTH);
            Type type = new TypeToken<ApiResponse<Integer>>() {
            }.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Integer>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<String> payAppOrderByWX(String orderNumber,String mchId,String appId) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("orderNumber", orderNumber);
            paramMap.put("mchId", mchId);
            paramMap.put("appId", appId);
            paramMap.put("version", 1.0);
            paramMap.put("method", PAY_APP_ORDER_BY_WX);
            Type type = new TypeToken<ApiResponse<String>>() {}.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<String>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<CouponModel> viewCouponModel(int couponModelId, String loginName, int channelId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("couponModelId", String.valueOf(couponModelId));
        paramMap.put("channelId", String.valueOf(channelId));
        paramMap.put("method", VIEW_COUPON_MODEL);
        Type type = new TypeToken<ApiResponse<CouponModel>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<CouponModel>(REQUEST_TIMEOUT);
        }
    }

    public ApiResponse<AddressModel> getAddress(String loginName) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("method", GET_ADDRESS);
        Type type = new TypeToken<ApiResponse<AddressModel>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<AddressModel>(REQUEST_TIMEOUT);
        }
    }

    public ApiResponse<List<CouponStore>> listCouponStore(int couponModelId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("couponModelId", String.valueOf(couponModelId));
        paramMap.put("method", LIST_COUPON_STORE);
        Type type = new TypeToken<ApiResponse<List<CouponStore>>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<List<CouponStore>>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<Void> endVerificationDelivery(int verificationId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("verificationId", String.valueOf(verificationId));
        paramMap.put("method", END_VERIFICATION_DELIVERY);
        Type type = new TypeToken<ApiResponse<Void>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Void>(REQUEST_TIMEOUT + e.toString());
        }
    }

    @Override
    public ApiResponse<Void> addComment(String orderId, String loginName, int couponModelId, int score, String content, String isHidden, int verificationId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        if (!TextUtils.isEmpty(orderId)) {
            paramMap.put("orderId", orderId);
        }
        paramMap.put("loginName", loginName);
        paramMap.put("couponModelId", String.valueOf(couponModelId));
        paramMap.put("score", String.valueOf(score));
        paramMap.put("content", content);
        paramMap.put("isHidden", isHidden);
        paramMap.put("verificationId", String.valueOf(verificationId));
        paramMap.put("method", ADD_COMMENT);
        Type type = new TypeToken<ApiResponse<Void>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Void>(REQUEST_TIMEOUT + e.toString());
        }
    }

    @Override
    public ApiResponse<Void> addFavorite(String loginName, int couponModelId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("couponModelId", String.valueOf(couponModelId));
        paramMap.put("method", ADD_FAVORITE);
        Type type = new TypeToken<ApiResponse<Void>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Void>(REQUEST_TIMEOUT + e.toString());
        }
    }

    @Override
    public ApiResponse<DeliveryModel> getVerificationDelivery(int verificationId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("verificationId", String.valueOf(verificationId));
        paramMap.put("method", GET_VERIFICATION_DELIVERY);
        Type type = new TypeToken<ApiResponse<DeliveryModel>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<DeliveryModel>(REQUEST_TIMEOUT + e.toString());
        }
    }

    @Override
    public ApiResponse<String> upload(String file, String fileName) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("file", file);
        paramMap.put("fileName", fileName);
        paramMap.put("method", UPLOAD);
        Type type = new TypeToken<ApiResponse<String>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<String>(REQUEST_TIMEOUT + e.toString());
        }
    }

    @Override
    public ApiResponse<List<IndustryGroupModel>> queryIndustryGroup() {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("method", QUERY_INDUSTRY_GROUP);
        Type type = new TypeToken<ApiResponse<List<IndustryGroupModel>>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }

    public ApiResponse<OrderInfo> payByWallet(String orderNumber, String loginName, String payPass) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("orderNumber", orderNumber);
        paramMap.put("loginName", loginName);
        paramMap.put("payPass", EncryptUtil.makeMD5(payPass));
        paramMap.put("method", PAY_BY_WALLET);
        Type type = new TypeToken<ApiResponse<OrderInfo>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<OrderInfo>(REQUEST_TIMEOUT + "  " + e.toString());
        }
    }

    public ApiResponse<String> createCouponPackageOrder(String loginName, String couponPackageId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("method", CREATE_COUPON_PACKAGE_ORDER);
        paramMap.put("couponPackageId", couponPackageId);
        Type type = new TypeToken<ApiResponse<String>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }

    public ApiResponse<OrderInfo> createCouponOrderNow(String loginName, int couponModelId, int count, int channelId, int plusModelId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("couponModelId", String.valueOf(couponModelId));
        paramMap.put("count", String.valueOf(count));
        paramMap.put("channelId", String.valueOf(channelId));
        paramMap.put("plusModelId", String.valueOf(plusModelId));
        paramMap.put("method", CREATE_COUPON_ORDER_NOW);
        Type type = new TypeToken<ApiResponse<OrderInfo>>() {}.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<OrderInfo>(e.toString());
        }
    }

    @Override
    public ApiResponse<OrderInfo> addFreeCoupon(String loginName, int couponModelId, int count, int channelId) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("loginName", loginName);
            paramMap.put("couponModelId", String.valueOf(couponModelId));
            paramMap.put("count", String.valueOf(count));
            paramMap.put("channelId", String.valueOf(channelId));
            paramMap.put("method", ADD_FREE_COUPON);
            Type type = new TypeToken<ApiResponse<OrderInfo>>() {}.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<Boolean> makeOrderToPaying(String orderId) {
        try {
            Map<String, Object> paramMap = new HashMap<String, Object>();
            paramMap.put("orderId", orderId);
            paramMap.put("method", MAKE_ORDER_TO_PAYING);
            Type type = new TypeToken<ApiResponse<Boolean>>() {}.getType();
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }

    public ApiResponse<VerificationModel> createQrCode(String loginName, int couponModelId, int count, int channelId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("loginName", loginName);
        paramMap.put("couponModelId", couponModelId + "");
        paramMap.put("count", count + "");
        paramMap.put("channelId", channelId + "");
        paramMap.put("method", CREATE_QR_CODE);
        Type type = new TypeToken<ApiResponse<VerificationModel>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }


    public ApiResponse<Void> cancleOrder(String orderNumber, String loginName) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("orderNumber", orderNumber);
        paramMap.put("loginName", loginName);
        paramMap.put("method", CANCLE_ORDER);
        Type type = new TypeToken<ApiResponse<String>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<Void>(REQUEST_TIMEOUT + e.toString());
        }
    }

    @Override
    public ApiResponse<Void> sendSmsCode4Register(String phoneNum) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("method", SEND_SMS_CODE_FOR_REGISTER);
        paramMap.put("phoneNum", phoneNum);
        Type type = new TypeToken<ApiResponse<Void>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<List<ContourMap>> getContour() {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("method", GET_CONTOUR);
        Type type = new TypeToken<ApiResponse<List<ContourMap>>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT);
        }
    }

    @Override
    public ApiResponse<List<CouponModel>> listHotCoupon(int pageSize, int currentPage) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("method", LIST_HOT_COUPON);
        paramMap.put("pageSize", pageSize);
        paramMap.put("currentPage", currentPage);
        Type type = new TypeToken<ApiResponse<List<CouponModel>>>() {
        }.getType();
        try {
            return httpEngine.postHandle(paramMap, type);
        } catch (Exception e) {
            return new ApiResponse<>(REQUEST_TIMEOUT + e.toString());
        }
    }
//
//    @Override
//    public ApiResponse<List<CommentModel>> listComment(int couponModelId, int currentPage, int pageSize) {
//        Map<String, Object> paramMap = new HashMap<String, Object>();
//        paramMap.put("method", LIST_COMMENT);
//        paramMap.put("couponModelId", String.valueOf(couponModelId));
//        paramMap.put("currentPage", String.valueOf(currentPage));
//        paramMap.put("pageSize", String.valueOf(pageSize));
//        Type type = new TypeToken<ApiResponse<List<CommentModel>>>() {
//        }.getType();
//        try {
//            return httpEngine.postHandle(paramMap, type);
//        } catch (Exception e) {
//            return new ApiResponse<>(REQUEST_TIMEOUT + e.toString());
//        }
//    }
}
